import QtQuick 2.15
import QtQuick.Controls 2.2
import QtQuick.Layouts
ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: "Custom Window with Border"
    
    TabBar {
        id: tabBar
        width: 600
        //contentHeight: 40
        contentWidth: 120
        currentIndex : 0
        
        TabButton {
            text: "Home"
            //onClicked: stackView.currentIndex = 0
        }
        TabButton {
            text: "Content"
            //onClicked: stackView.currentIndex = 1
        }
        TabButton {
            text: "About"
            //onClicked: stackView.currentIndex = 2
        }
    }
     
    StackLayout {
        id: stackView
        currentIndex: tabBar.currentIndex  //直接绑定TabBar的currentIndex
        anchors.top: tabBar.bottom
        width: parent.width
        height: parent.height - tabBar.height
        Item {
            id: homePage
            Rectangle {
                Label {
                    text: "Home Page"
                }
            }
        }
        Item {
            id: contentPage
            Rectangle {
                Label {
                    text: "Content Page"
                }
            }
        }
        Item {
            id: aboutPage
            Rectangle {
                Label {
                    text: "About Page"
                }
            }
        }
    }
}
